╨RINTING DOESN'T HAVE TO BE STUFFY AND SERIOUS, WE CAN DO SILLY THINGS. ╙EVERAL PROGRAMS THAT FOLLOW SHOW HOW, BY USING FAIRLY SIMPLE TECHNIQUES, WE CAN DISPLAY THINGS ON THE SCREEN IN UNUSUAL WAYS. ╘HIS SECTION CAN GIVE YOU IDEAS, AS WELL AS SHOW SOME CODING METHODS TO PUT SCREEN OUTPUT UNDER YOUR CONTROL. ╞EEL FREE TO EXPERIMENT. ┘OU CAN'T HURT THE MACHINE.
Ç*CN1;--- ╧╙├╔╠╠╧╙├╧╨┼ ---Ç*CN0
╨ROGRAM ┴├╥╧╙╙ FLIES THE "GREATER THAN" (>) CHARACTER ACROSS THE SCREEN, OSCILLOSCOPE FASHION, OVER AND OVER THE SAME LINE.
// PRG: ACROSS //
Ç*FP5
*** ╓┴╥╔┴┬╠┼╙ ***
╩ TRACKS SCREEN POSITIONS
╙═ SCREEN ADDRESS IN MEMORY
╦ DELAY COUNTER
*** ╔╬╙╘╥╒├╘╔╧╬╙ ***
╫HEN YOU ENTER THE PROGRAM, MAKE SURE THAT THE SEMICOLONS ARE TYPED IN WHERE THEY BELONG, AND THAT THE NUMBERS IN LINE 190 ARE EXACTLY AS LISTED. ╘HERE ARE TWO PROGRAMS IN ONE HERE. ╘YPE ╥╒╬ TO WORK THE FIRST PART, OR ╥╒╬ 190 FOR THE SECOND PART. ╒SE THE ╙╘╧╨ KEY WHEN YOU HAVE SEEN ENOUGH OF IT.
*** ─┼╘┴╔╠╙ ***
╘HE FIRST PART ╨╥╔╬╘S EVERYTHING. ├╚╥$(157) IS THE SAME THING AS IF YOU HAD TYPED CURSOR-LEFT IN QUOTES. ├╚╥$(145) IS THE SAME THING AS IF YOU HAD TYPED CURSOR-UP IN QUOTES. ╘HE ">" CHARACTER IS PRINTED AND "MOVED" 38 TIMES PER SCREEN LINE. ╘HAT IS CONTROLLED BY THE ╞╧╥...╬┼╪╘ LOOP SPANNING LINES 130-150. ╘HEN A DASH IS PRINTED IN THE LAST POSITION AND THE PROCESS REPEATS. ╘HE REPETITION IS CODED IN LINE 170 BY USE OF A KEYWORD ╟╧╘╧.
╘HE CODE FROM LINE 190 ON IS JUST ANOTHER WAY OF TALKING TO THE COMPUTER. ╔T STUFFS THE SCREEN DIRECTLY WITH THE CHARACTERS, BY A PROCESS CALLED ╨╧╦┼. ╘HE SCREEN IS A SEGMENT OF COMPUTER'S MEMORY. ╔T'S LOCATION IS HELD IN VARIABLE ╙═. ╘HIS TIME, FORTY TIMES (0 TO 39) PER SCREEN LINE WE PLACE A BIG FAT DOT (THE SAME AS ON THE ╤-KEY, SCREEN CODE 81) ON A SCREEN LINE. ╘HEN WE DELAY TO THE COUNT OF TEN (LINE 220), AND FINALLY, WE ERASE THE DOT BY REPLACING IT WITH A DASH (LINE 230). ╫E DO THE SAME THING IN THE NEXT SCREEN POSITION, CREATING AN ILLUSION OF MOTION. ┴FTER THE ENTIRE LINE IS DONE, WE CALL FOR A REPEAT (LINE 250). ╔T SO CONTINUES UNTIL YOU PRESS THE ╙╘╧╨ KEY.
*** ╨╥╧╩┼├╘╙ ***
═AKE BOTH SECTIONS WORK ON A DIFFERENT LINE OF THE SCREEN. ╚INT FOR THE FIRST PART: POSITION THE CURSOR ON THE SCREEN BEFORE ASKING TO ╥╒╬. ┘OU CAN ALSO PRINT CURSOR HOME OR DOWN BY PLACING THEM IN QUOTES.
╚INT FOR THE SECOND PART: ADD IN 40 (THE COMPUTER'S SCREEN WIDTH IN CHARACTERS) TO ╙═ FOR EACH LINE YOU GO DOWN.
╔NSTEAD OF PRINTING OVER DASHES, PRINT OVER SPACES SO THAT ONLY ">" APPEARS. ┘OU CAN ALSO CHANGE ">" TO SOME OTHER CHARACTER. ┘OU CAN USE THE GRAPHIC CHARACTERS THAT YOU SEE ON THE KEYS BY PLACING THEM INSIDE THE QUOTES IN A ╨╥╔╬╘ STATEMENT.
Ç*CN1;--- ┬╧╒╬├┘ ╨╥╔╬╘ ---Ç*CN0
╨ROGRAM ┬╧╒╬├┼ DOES JUST THAT TO WHATEVER YOU TYPE INSIDE THE ═$ STRING. ╔T USES THE ┼╙├ KEY PLUS ╔ OR ─ TO INSERT OR DELETE LINES IN ORDER TO TO BOUNCE THINGS UP AND DOWN. ╘HE STRING EVENTUALLY SETTLES IN THE MIDDLE OF THE SCREEN.
// PRG: BOUNCE //
Ç*FP6
*** ╓┴╥╔┴┬╠┼╙ ***
╬ COUNTS BOUNCES
─╠ DELAY COUNTER
═$ MESSAGE TO PRINT
╩,╦ WORKING VALUES
*** ╔╬╙╘╥╒├╘╔╧╬╙ ***
╘YPE IN AND ╥╒╬. ╒SE ╙╘╧╨ KEY TO STOP IT.
Ç*FP4;*** ─┼╘┴╔╠╙ ***
╘HE BOUNCES ARE COUNTED IN VARIABLE ╬. ├URRENTLY, WE ASK FOR 12 BOUNCES, BEGINNING AT SCREEN LINE 12 (COUNT FROM ZERO!). ╫ITH EACH BOUNCE, ╬ IS DECREASED BY 1. ╔N LINE 160 WE SUBTRACT ONE FROM ╬. ╘HEN, USING A PAIR OF ┬┴╙╔├ KEYWORDS ╔╞ AND ╟╧╘╧ WE DECIDE WHETHER TO KEEP LOOPING OR QUIT. ╔F ╬ IS ANY VALUE OTHER THAN ZERO, WE KEEP BOUNCING. ╧THERWISE THE PROGRAM FALLS TO LINE 170 TO QUIT. ╔╞...╘╚┼╬ 140 OR ╔╞...╘╚┼╬ ╟╧╘╧ 140 ARE ALTERNATIVE, PERMITTED, WAYS OF STATING THE SAME THING. ╫E COULD HAVE ALSO WRITTEN THE TEST AS ╔╞ ╬<>0 TO MEAN IF ╬ IS NOT EQUAL TO ZERO..., BUT IT'S NOT NECESSARY IN ├OMMODORE ┬┴╙╔├.
╘HE BOUNCING ITSELF IS CODED IN A SUBROUTINE IN LINES 180-190. ┴ SUBROUTINE IS A BUZZWORD MEANING, USUALLY, REUSABLE CODE. ╚ERE, THE ┼╙├ CHARACTER (27) IS PRINTED, FOLLOWED BY EITHER THE ╔NSERT- OR THE ─ELETE-FULL-LINE CHARACTER. ╘HE LITTLE SUBROUTINE PRINTS WHATEVER VALUE THE MAIN PROGRAM GAVE IT, A "─" ON AN "╔".
╘HERE IS A DELAY BUILT IN FOR SLOWING THINGS DOWN. ╘HE AMOUNT OF DELAY IS ─╠. ┴ LOOP WITH A COUNTER ╦ CONTROLS THE AMOUNT OF THE DELAY. ╠INE 190 IS BOTH THE BEGINNING AN THE END OF THAT LOOP. ┴ CODE SUCH AS ╬┼╪╘ ╦,╩ MEANS THE SAME THING AS ╬┼╪╘ ╦:╬┼╪╘ ╩.
*** ╨╥╧╩┼├╘╙ **
├HANGE THE DELAY BETWEEN BOUNCES. ├HANGE THE NUMBER OF BOUNCES IF YOU WISH, AND CHANGE THE STARTING POSITION FROM 12 TO ANOTHER NUMBER. ═AKE SURE THAT THESE NUMBERS ARE COORDINATED. ─O NOT LET THE LETTERS BOUNCE OFF THE SCREEN AND VANISH.
┬OUNCE IS FUN TO WATCH BUT IS LIMITED, AS IT AFFECTS THE ENTIRE SCREEN. ╘RY IT WITHOUT CLEARING THE SCREEN, AND OBSERVE THE DEVASTATION. ╘HEN THINK ABOUT WHAT IS INVOLVED TO PREVENT OTHER LINES ON THE SCREEN FROM BEING AFFECTED. ╘HINK OF THE SMALLEST AREA TO USE AND HOW TO ACCOMPLISH THAT.
Ç*CN1;--- ═┴╦╔╬╟ ┴ ├╧╠╧╥ ├╚┴╥╘ ---Ç*CN0
╘HIS PROGRAM PRINTS A NEAT LOOKING COLOR CHART. ╔T SHOWS ALL THE COMPUTER'S COLORS AND LUMINANCES. ╔N LINE 190 THE GRAPHICS IN QUOTES ARE SHIFTED "╧" AND "╨" TO MAKE A TOP OF A TWO-CHARACTER BOX.
// PRG: COLOR CHART //
Ç*FP6
*** ╓┴╥╔┴┬╠┼╙ ***
├ IS THE CURSOR COLOR NUMBER RANGING FROM 1 TO 16
INITIALLY IT IS SET TO 1, OR BLACK
╠ IS THE LUMINANCE, OR BRIGHTESS, LEVEL,
RANGING FROM 0 TO 7, INITIALLY 7 OR BRIGHT
*** ╔╬╙╘╥╒├╘╔╧╬╙ ***
╘O TYPE THE GRAPHIC CHARACTERS IN LINE 190 FOLLOW THE ╥┼═ARKS. ┘OU NEED TO TYPE ├╘╠-╥╓╙ THEN GRAPHICS ON KEYS "O" AND "P" AND ├╘╠-╥╓╙-╧╞╞. ╔F YOU ARE TYPING IN LOWER CASE, SWITCH TO GRAPHICS USING THE ├OMMODORE-╠OGO KEY AND ╙╚╔╞╘ AT THE SAME TIME.
┬EFORE RUNNING THE PROGRAM, SET THE SCREEN BACKGROUND COLOR TO EITHER WHITE OR BLACK:
├╧╠╧╥ 0,1 BLACK
├╧╠╧╥ 0,2,7 WHITE, VERY BRIGHT
╔T CAN BE ╥╒╬ ON A WHITE BACKGROUND, AND YOU CAN USE IT TO ADJUST YOUR MONITOR OR ╘╓ TO GET THE BEST COLORS. ╨LAY WITH THE BRIGHTNESS AND CONTRAST CONTROLS, YOU MAY BE SURPRISED AT THE RESULTS. ╬OTICE THAT ON THE SCREEN THE SEVEN BRIGHTNESS LEVELS VARY FROM COLOR TO COLOR CONSIDERABLY.
╘HE PROGRAM STOPS BY ITSELF WHEN IT IS DONE.
*** ─┼╘┴╔╠╙ ***
╔F ╥╒╬ ON A BLACK BACKGROUND, THE BLACK SET OF BARS WILL, OF COURSE, BE INVISIBLE. ┬UT THE REMAINING COLORS CREATE A STAINED GLASS EFFECT, WORTH LOOKING AT.
╘HE PROGRAM CYCLES THROUGH ALL THE COLORS WHILE THE LUMINANCE IS HELD CONSTANT. ╫HILE THE COLOR COUNT IS SMALLER THAN 17 WE KEEP LOOPING (SEE LINE 200). ╫HEN WE EXCEED THE PERMITTED VALUE, THE COLOR IS RESET TO 1 AND WE DECREASE THE LUMINANCE LEVEL. ╙O LONG AS THE LUMINANCE IS ZERO OR LARGER WE KEEP LOOPING, OTHERWISE WE PRINT A BLANK LINE AND QUIT.
*** ╨╥╧╩┼├╘╙ **
╔NSTEAD OF A BOX, PRINT SOME OTHER GRAPHIC CHARACTERS, YOU MAY LIKE THE RESULT BETTER.
╥EORGANIZE THE PRINTING LOOPS TO PRINT THE LUMINANCES ACROSS AND THE COLORS GOING DOWN?
╘RY YOUR HAND AT A DIFFERENT CODING APPROACH; INSTEAD OF ╔╞...╟╧╘╧ COMBINATIONS, CODE THE ╞╧╥...╬┼╪╘ LOOPS. ┬EGIN WITH THE INNER LOOP (COLOR, IN THE ORIGINAL PROGRAM) AND WHEN THAT WORKS, RECODE THE OUTER LOOP (LUMINANCE).
Ç*CN1;--- ╘╚┼ ╔╬├╥┼─╔┬╠┼ ╙├╥┼┼╬ ═┴╟╔├ ---Ç*CN0
╘HINGS CAN GET A BIT TEDIOUS WHEN YOU'RE JUST LEARNING TO WORK A NEW MACHINE, SO A BIT OF EDUCATIONAL ENTERTAINMENT IS IN ORDER NOW. ╘HE PROGRAM THAT FOLLOWS IS A PLEASURE TO WATCH, BUT RATHER DIFFICULT TO UNDERSTAND. (╬OTHING THAT FOLLOWS DEPENDS ON YOUR UNDERSTANDING OF THIS SECTION).
╘HIS TINY ROUTINE WAS ORIGINALLY WRITEN FOR THE ╨┼╘ COMPUTER BY ┬ENNY ╨RUDEN FOR THE ╘╚┼ ╘╥┴╬╙┴├╘╧╥. ╘HE PROGRAM CREATES A LARGE VARIETY OF VISUAL DISPLAYS THAT YOU CAN WATCH FOR HOURS. ╘HIS IS AN ADAPTATION THAT ADDS COLOR TO THE DISPLAY.
// PRG: CRAZY STUFF //
Ç*FP9
*** ╓┴╥╔┴┬╠┼╙ ***
├ LOCATION OF THE COLOR PART OF THE SCREEN DISPLAY
╙1 THE LOCATION OF THE SCREEN MEMORY, WHERE THE
CHARACTERS GO
╙ THE ╙├╥┼┼╬ CODE FOR THE SPACE CHARACTERS
╥ WORKING VALUE EQUAL TO 32+160 (SPACE
AND REVERSE SPACE)
╙0 WORKING VALUE, ALWAYS ZERO
ALL OTHER VARIABLES ARE LOOPS COUNTERS.
*** ╔╬╙╘╥╒├╘╔╧╬╙ ***
╥╒╬ IT, WAIT A LITTLE WHILE FOR THE CODE TO WARM UP, AND ENJOY THE SHOW. ╔T DOES END BY ITSELF, BUT IF YOU WISH TO STOP IT EARLY, THE ╙╘╧╨ KEY CAN BE USED.
*** ─┼╘┴╔╠╙ ***
╠INES 36-37 FILL EACH LINE ON THE SCREEN WITH DIFFERENT COLOR, 1 TO 15 AND AGAIN. ╘HAT'S DONE JUST ONCE. ├URRENTLY IT IS CODED IN A DOUBLE LOOP; THE ╩-LOOP CONTROLS THE 25 SCREEN LINES BY HOPPING 40 POSITIONS EACH TIME (╙╘┼╨ 40 MEANS JUST THAT). ╞OR EACH SCREEN LINE, THE ╦-LOOP TAKES CARE OF THE 40 CHARACTERS ON THE LINE. ┴ VALUE OF ╬ IS ╨╧╦┼D INTO THE COLOR MEMORY. ╘HERE IS ONLY ONE REASON WHY A DOUBLE LOOP WAS CODED - SO THAT YOU CAN CHANGE, IF YOU WISH, THE INDIVIDUAL COLORS IN EACH SCREEN POSITION WITHOUT THE NEED FOR MUCH RECODING.
╘HE EXCITING PART OF THIS PROGRAM IS IN LINES 50 TO 55. ╘HEY PERFORMS ALL THE SCREEN GYMNASTICS YOU SEE. ╘HEY CONSTANTLY MODIFY THE ╨╧╦┼ ADDRESSES AS WELL AS THE MODE: REVERSE OR UNREVERSE. ╘HIS IS DONE BY A FLIP OF THE NUMBERS USING THE ╥ AND THE ╙ VALUES. ╘HE SIZE OF THE AREA AFFECTED IS VARIED BY ╬, ┴ AND ┬ EVER CHANGING VALUES.
*** ╨╥╧╩┼├╘ ╞╧╥ ╓┼╥┘ ├╒╥╔╧╒╙ ╨┼╧╨╠┼ ***
╔T IS POSSIBLE TO LEARN ABOUT DIFFICULT-LOOKING PROGRAMS BY TAKING THEM APART BIT BY BIT. ╒SE THE ╙╘╧╨-KEY A LOT. ╫HEN THE COMPUTER PRINTS ┬╥┼┴╦ ╔╬ SOME LINE NUMBER, PRINT OUT THE VALUES THAT YOU THINK ARE AFFECTING WHAT THE PROGRAM DOES. ╥ESUME THE RUN BY TYPING ├╧╬╘ (STANDS FOR ├╧╬╘╔╬╒┼), ╙╘╧╨ IT AGAIN AND SO ON UNTIL YOU GET AN IDEA OF WHAT IS HAPPENING. ┼NJOY THE SNOOPING PROCESS, IT CAN REALLY BE A LOT OF FUN!
Ç*CN1;--- ┌╔╟-┌┴╟ ╨╥╔╬╘╔╬╟ ---Ç*CN0
╘HE FOLLOWING PROGRAM PRINTS YOUR NAME, OR YOUR CAT'S NAME, OR ANYTHING YOU WISH (SO LONG AS IT IS UNDER 39 CHARACTERS LONG) IN A ZIG-ZAG FASHION ON THE SCREEN UNTIL YOU PRESS THE ╙╘╧╨ KEY.
// PIC: STR.A //
// PRG: STRINGS ZIG-ZAG //
Ç*FP12
*** ╓┴╥╔┴┬╠┼╙ ***
┬$ CHARACTER STRING CONTAINS 39 SPACES
INITIALLY IT IS 13, MADE LONGER BY ADDITION
IN LINE 140
═$ IS THE CHARACTER STRING TO PRINT,
YOUR NAME IS AN EXAMPLE
┬ INITIALLY A DIFFERENCE IN CHARACTER COUNTS
(THEIR LENGTHS)
┴ INITIALLY ZERO
╙ INITIALLY +1
├ WORKING VARIABLE TO PERMIT EXCHANGING VALUES ┴ AND ┬
*** ╔╬╙╘╥╒├╘╔╧╬╙ ***
═AKE SURE THAT INSIDE THE QUOTES IN LINE 130 YOU HAVE EXACTLY 13 SPACES. ╘HE NUMBERS ARE THERE JUST FOR COUNTING. ╘YPE ANYTHING YOU WISH IN THE QUOTES IN LINE 140. ╥╒╬ THE PROGRAM. ╔T CAN BE ╙╘╧╨PED WITH A ╙╘╧╨ KEY.
*** ─┼╘┴╔╠╙ ***
╘HE IDEA IS TO PRINT A SET OF LETTERS ACROSS THE SCREEN ON ONE LINE. ╧N THE NEXT LINE, WE INCREASE THE STARTING POSITION AND DO SO UNTIL WE BUMB INTO THE EDGE OF THE SCREEN. ╘HE NUMBER OF SPACES WE PRINT IS DETERMINED BY ╩ÇúWHICH VARIES FROM ┴ TO ┬. ╘HIS IS CODED IN LINE 180 WHERE WE TAKE A SEGMENT OF OUR 39 SPACES AND PRINT ╩ CHARACTERS OF IT FOLLOWED BY ═$.
╫HEN WE BUMP INTO THE RIGHT HAND SIDE EDGE OF THE SCREEN, THE SPACES NEED TO BE PRINTED ON THE OTHER SIDE. ╙O WE TURN ALL THE VALUES AROUND: WHAT WAS ┴ BECOMES ┬, WHAT WAS ┬ BECOMES ┴ AND THE STEP SIZE GETS FLIPPED BETWEEN +1 AND -1. ╞OR EXAMPLE, IF ┴ WERE 0 AND ┬ WERE 4, ╙ WOULD BE 1. ╘HE CODE WOULD MEAN ╞╧╥ ╩=0 ╘╧ 4 ╙╘┼╨ 1 (0,1,2,3,4). ┴FTER A FLIP, THE CODE WOULD MEAN ╞╧╥ ╩=4 ╘╧ 0 ╙╘┼╨ -1 (4,3,2,1,0).
*** ╨╥╧╩┼├╘╙ ***
├HANGE WHAT PRINTS BY CHANGING ═$. ┬E SURE TO INCLUDE GRAPHICS. ┴DD SOME COLOR AND PERHAPS REVERSE AND FLASHING CHARACTERS TO IT. ╘HINK OF DESIGNING A RACE COURSE WITH AN IMAGINARY CAR AT THE BOTTOM OF THE SCREEN.
╘RY NARROWING THE SWITCHBACK SIZE SO THAT THE ZIG-ZAG PATTERN WILL COVER LESS AREA SIDE TO SIDE. ╔F YOU'RE REALLY AMBITIOUS, YOU MIGHT TRY VARYING THE AMOUNT OF TURNS WITH EACH PRINT STATEMENT FOR STILL ANOTHER EFFECT. ┬UT DO CONSIDER THE BOUNDRIES OF THE SCREEN, YOU MUST NOT ALLOW THE SCREEN, OR THE MESSAGE, TO SPLIT!